<?xml version="1.0" encoding="ISO-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:t="http://myfaces.apache.org/tomahawk"
      xmlns:a="http://www.andromda.org/cartridges/jsf"
      xmlns:tr="http://myfaces.apache.org/trinidad"
      xmlns:ajsfc="http://www.andromda.org/cartridges/jsf/facelets"
      >

<ui:composition template="/layout/layout.xhtml">
    <ui:param name="partialTriggers" value="#{fn:split(':manageLoginSessionForm_search:newAction :manageLoginSessionForm_search:searchResult:loadAction :manageLoginSessionForm_edit:saveAction :manageLoginSessionForm_edit:saveAndNewAction :manageLoginSessionForm_edit:cancelAction',' ')}"/>
    <ui:param name="usesUpload" value="false"/>
    <ui:define name="title">
        <c:set var="title" value="#{messages['login.session.view.title']}#{messages['title.action.separator']}#{messages[manageLoginSessionForm.editState ? (empty manageLoginSessionForm.id ? 'title.action.new' : 'title.action.edit') : 'title.action.search']}" scope="request"/>
    </ui:define>
    <ui:define name="content">
        <tr:panelGroupLayout layout="vertical" inlineStyle="display:#{manageLoginSessionForm.editState?'none':''}">
        <tr:subform id="manageLoginSessionForm_search">
        <tr:panelFormLayout>
        <tr:selectOneChoice id="searchForm_status" value="#{manageLoginSessionForm.searchForm.status}" label="#{messages['login.session.status']}:" required="false" readOnly="false" unselectedLabel="">
            <f:converter converterId="com.systemsjr.jrbase.loginsession.SessionStatus"/>
            <f:selectItems value="#{ajsfc:getEnumSelectItems('session.status.','com.systemsjr.jrbase.loginsession.SessionStatus')}"/>
        </tr:selectOneChoice>
        <tr:selectOneChoice id="searchForm_user" value="#{manageLoginSessionForm.searchForm.user}" label="#{messages['login.session.user']}:" required="false" readOnly="false" unselectedLabel="">
            <c:if test="${!empty manageLoginSessionForm.userBackingList}">
                <c:forEach var="row" items="#{manageLoginSessionForm.userBackingList}">
                    <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                </c:forEach>
            </c:if>
        </tr:selectOneChoice>
        <tr:selectOneChoice id="searchForm_area" value="#{manageLoginSessionForm.searchForm.area}" label="#{messages['login.session.area']}:" required="false" readOnly="false" unselectedLabel="">
            <c:if test="${!empty manageLoginSessionForm.areaBackingList}">
                <c:forEach var="row" items="#{manageLoginSessionForm.areaBackingList}">
                    <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                </c:forEach>
            </c:if>
        </tr:selectOneChoice>
        <f:facet name="footer">
            <tr:panelButtonBar>
                <tr:commandButton id="searchAction" text="#{messages['action.search']}" action="#{loginSessionController.search}" accessKey="#{messages['action.search.access.key']}" partialSubmit="true"/>
                <tr:commandButton id="newAction" text="#{messages['action.new']}" action="#{loginSessionController.startNew}" accessKey="#{messages['action.new.access.key']}" partialSubmit="true" immediate="true"/>
            </tr:panelButtonBar>
        </f:facet>
        </tr:panelFormLayout>
        <tr:spacer width="1" height="10"/>
        <tr:table id="searchResult" allDetailsEnabled="true" var="row" rowBandingInterval="1" value="#{manageLoginSessionForm.manageableList}" rows="#{preferences.maxTableRows}" width="90%" inlineStyle="display:#{manageLoginSessionForm.manageableList == null? 'none': ''}" partialTriggers="searchResult:deleteAction ::searchAction">
            <f:facet name="footer">
                <h:panelGroup>
                    <tr:outputText value="#{fn:length(manageLoginSessionForm.manageableList)}">
                        <f:convertNumber groupingUsed="true"/>
                    </tr:outputText>
                    <tr:spacer width="10" height="1"/>
                    <tr:outputText value="#{messages['records.found']}"/>
                </h:panelGroup>
                <h:panelGroup style="width:100%;font-weight:normal">
                    <tr:outputText value="#{fn:length(manageLoginSessionForm.manageableList)}" inlineStyle="display:#{empty manageLoginSessionForm.manageableList?'none':''}">
                        <f:convertNumber groupingUsed="true"/>
                    </tr:outputText>
                    <tr:spacer width="10" height="1" inlineStyle="display:#{empty manageLoginSessionForm.manageableList?'none':''}"/>
                    <tr:outputText value="#{messages['records.found']}" inlineStyle="display:#{empty manageLoginSessionForm.manageableList?'none':''}"/>
                    <tr:outputText value="#{messages['empty.result.set']}" inlineStyle="display:#{empty manageLoginSessionForm.manageableList?'':'none'}"/>
                </h:panelGroup>
            </f:facet>
            <tr:column width="46px">
                <f:facet name="header">
                    <h:panelGroup>
                        <tr:commandLink action="#{loginSessionController.odsExport}" inlineStyle="display:#{empty manageLoginSessionForm.manageableList?'none':''}">
                            <tr:image source="/images/spreadsheet.png" shortDesc="#{messages['export.spreadsheet']}" inlineStyle="border-style:none" />
                        </tr:commandLink>
                    </h:panelGroup>
                </f:facet>
                <h:panelGroup>
                    <tr:commandLink id="loadAction" actionListener="#{loginSessionController.load}" partialSubmit="true" immediate="true">
                       <tr:image source="/images/tableLoad.gif" shortDesc="#{messages['action.load']}" inlineStyle="border-style:none" />
                       <f:param name="id" id="id" value="#{row.id}" />
                    </tr:commandLink>
                    <tr:spacer width="10" height="1"/>
                    <tr:commandLink id="deleteAction" actionListener="#{loginSessionController.delete}" partialSubmit="true" immediate="true">
                        <tr:image source="/images/tableDelete.gif" shortDesc="#{messages['action.delete']}" inlineStyle="border-style:none" />
                        <f:param name="id" id="id" value="#{row.id}" />
                    </tr:commandLink>
                </h:panelGroup>
            </tr:column>
            <tr:column sortable="true" sortProperty="status">
                <f:facet name="header">
                    <tr:outputText value="#{messages['login.session.status']}"/>
                </f:facet>
                <tr:outputText value="#{ajsfc:getEnumMessage('session.status.',row.status)}">
                </tr:outputText>
            </tr:column>
            <tr:column sortable="false">
                <f:facet name="header">
                    <tr:outputText value="#{messages['user.view.title']}"/>
                </f:facet>
                <tr:outputText value="#{row.user}" converter="com.systemsjr.jrbase.user.crud.UserJsfConverter"/>
            </tr:column>
            <tr:column sortable="false">
                <f:facet name="header">
                    <tr:outputText value="#{messages['location.view.title']}"/>
                </f:facet>
                <tr:outputText value="#{row.area}" converter="com.systemsjr.jrbase.location.crud.LocationJsfConverter"/>
            </tr:column>
        </tr:table>
        </tr:subform>
        </tr:panelGroupLayout>
        <tr:panelGroupLayout layout="vertical" inlineStyle="display:#{manageLoginSessionForm.editState?'':'none'}">
        <tr:subform id="manageLoginSessionForm_edit" >
            <tr:panelFormLayout>
            <tr:selectOneChoice id="status" value="#{manageLoginSessionForm.status}" label="#{messages['login.session.status']}:" required="true" readOnly="false" unselectedLabel="">
                <f:converter converterId="com.systemsjr.jrbase.loginsession.SessionStatus"/>
                <f:selectItems value="#{ajsfc:getEnumSelectItems('session.status.','com.systemsjr.jrbase.loginsession.SessionStatus')}"/>
            </tr:selectOneChoice>
            <tr:inputHidden id="id" value="#{manageLoginSessionForm.id}"/>
            <tr:selectOneChoice id="user" value="#{manageLoginSessionForm.user}" label="#{messages['login.session.user']}:" required="true" readOnly="false" unselectedLabel="">
                   <c:if test="${!empty manageLoginSessionForm.userBackingList}">
                       <c:forEach var="row" items="#{manageLoginSessionForm.userBackingList}">
                           <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                       </c:forEach>
                   </c:if>
            </tr:selectOneChoice>
            <tr:selectOneChoice id="area" value="#{manageLoginSessionForm.area}" label="#{messages['login.session.area']}:" required="true" readOnly="false" unselectedLabel="">
                   <c:if test="${!empty manageLoginSessionForm.areaBackingList}">
                       <c:forEach var="row" items="#{manageLoginSessionForm.areaBackingList}">
                           <f:selectItem itemLabel="#{row[1]}" itemValue="#{row[0]}" />
                       </c:forEach>
                   </c:if>
            </tr:selectOneChoice>

            <f:facet name="footer">
                   <tr:panelButtonBar>
                       <tr:commandButton id="saveAction" text="#{messages['action.save']}" action="#{loginSessionController.save}" accessKey="#{messages['action.save.access.key']}" partialSubmit="false"/>
                       <tr:commandButton id="saveAndNewAction" text="#{messages['action.saveAndNew']}" action="#{loginSessionController.saveAndNew}" accessKey="#{messages['action.saveAndNew.access.key']}" inlineStyle="display:#{(empty manageLoginSessionForm.id)?'':'none'}" partialSubmit="false"/>
                       <tr:commandButton id="cancelAction" text="#{messages['action.cancel']}" action="#{loginSessionController.cancel}" accessKey="#{messages['action.cancel.access.key']}" immediate="true" partialSubmit="true" />
                   </tr:panelButtonBar>
            </f:facet>
            </tr:panelFormLayout>
        </tr:subform>
        </tr:panelGroupLayout>
    </ui:define>
</ui:composition>

</html>
